#pragma once
#include "Page.h"
#include "typedef.h"

namespace MircoUi {
    class PlotPage : public Page {
    private:                        
    public:          
        tEvent eventCB; // 事件回调函数  
        byte plot[128];
        char* title; // 页面标题  
        uint8 plot_ptr; // 绘图指针，指向当前绘图的最新值
        uint8 plot_len; // 绘图长度，从当前指针开始向后绘图
    private:                        
        uint8 status;
    public:        
        void init(char* title) {
            this->title = title; 
            this->eventCB = nullptr; // 初始化事件回调函数为nullptr
            this->plot_ptr = 0;
            this->plot_len = 0;
            this->status = 0; // 页面状态初始化为未绘制
        }
        virtual void refresh();           
        virtual void onEvent(uint32 event_id, uint32 event_par); 
        void clear();
        void appendPlot(uint8 value);
    };
}

